package kevin.framework.basic.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import kevin.framework.basic.common.utils.MyUUID;
import kevin.framework.basic.dao.IBaseDao;
import kevin.framework.basic.service.impl.BaseService;
import kevin.framework.basic.dao.IFuncDao;
import kevin.framework.basic.domain.Func;

import kevin.framework.basic.service.IFuncService;

/**
*Generate by Kevin's CodeBuilder
**/
@Service
public class FuncService extends BaseService<Func, String> implements IFuncService {

		private static final long serialVersionUID = -1L;

		private  IFuncDao funcDao;

		@Resource(name="funcDao")
		@Override
		public void setDao(IBaseDao<Func, String> dao) {
				this.dao = dao;
				funcDao = (IFuncDao)dao;
		}
		
		@Override
		public List<Func> login(String userId) throws Exception {
			// TODO Auto-generated method stub
			return funcDao.login(userId);
		}

		@Override
		public void insertList(List<Func> list) throws Exception {
			for(Func f : list) {
				Map<String,Object> countParams = new HashMap<String,Object>();
				countParams.put("menuId", f.getMenuId());
				countParams.put("funcCode", f.getFuncCode());
				if(this.count(countParams) == 0) {
					 super.insert(f);
				}
			}
		}		
		@Override
		public String getOperatorDesp(String controller, String cmd) throws Exception {
			return ((IFuncDao)this.dao).getOperatorDesp(controller,cmd);
		}
		
}
